<template>
  <footer>
    <div>
      <div class="icon">
        <van-icon name="shopping-cart-o" size="30" @click="icon" />
      </div>
    </div>
    <span>
      <strong> ￥{{ Price }} </strong>
    </span>
    <small>另需配送费￥4元</small>
    <strong v-show="Price >= 20">可配送</strong>
    <strong v-show="Price < 20">￥{{ 20 - Price }}起送</strong>
  </footer>
</template>

<script>
export default {
  name: "",
  data() {
    return {
      show: false,
    };
  },
  mounted() {},
  methods: {
    icon() {
      this.show = true;
      this.$emit("fot", this.show);
    },
  },
  computed: {
    Price() {
      let cont = 0;
      this.$store.state.shopping.forEach((ele) => {
        cont += ele.num * ele.price;
      });
      return cont;
    },
  },
  watch: {},
};
</script>

<style lang="scss" scoped>
footer {
  width: 100%;
  height: 50px;
  z-index: 99999;
  background: #141d27;
  align-self: flex-end;
  position: fixed;
  bottom: 0;
  left: 0;
  color: #888;
  & > div {
    width: 60px;
    height: 60px;
    background: #141d27;
    border-radius: 50%;
    position: absolute;
    bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: space-around;
    margin-left: 15px;
  }
  .icon {
    width: 40px;
    height: 40px;
    background: #ddd;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: space-around;
  }
  & > span {
    height: 50px;
    border-right: 1px solid #cccc;
    margin-left: 90px;
    font-size: 25px;
    line-height: 50px;
    margin-right: 10px;
    padding-right: 10px;
  }
  & > strong {
    width: 80px;
    height: 100%;
    background: #ddd;
    display: block;
    float: right;
    font-size: 18px;
    line-height: 50px;
  }
}
</style>
